package com.tenement.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.*;

import java.io.Serializable;
import java.sql.Timestamp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 *  实体类。
 *
 * @author BertXie
 * @since 1.0.1
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "sys_user",dataSource = "tenement")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Generator, value = "snowFlakeId")
    private Long id;

    private Long pId;

    private int type;


    private String name;

    private String email;

    @NotBlank(message = "电话号码不能为空")
    @Pattern(regexp = "^(1[3-9]\\d{9})$",message = "手机号码格式错误")
    private String phoneNumber;


    private String account;


    @JsonIgnore
    private String passwordHash;



    private Long propertyId;

    @Column(tenantId = true)
    private Long tenementId;


    private Long departmentId;

    private Long positionId;

    private Short isActive;

    private String profilePicture;


    private String realName;

    @Column(onInsertValue = "now()")
    private Timestamp createTime;

    @Column(onUpdateValue = "now()")
    private Timestamp updateTime;

    private String education;

    private String major;

    private String graduatedFrom;

    private Timestamp joinDate;

    private String contractPeriod;

    private Timestamp contractExpiryDate;

    private String idCard;


    private String emergencyContactName;


    private String emergencyContactPhoneNumber;

    private int sex;


    private Dept dept;


    private Post post;


    private Properties properties;

    private HouseUser houseUser;



}
